package nl.vu.few.ibivu.biomodels.client.ui.cytoscapeweb;


import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.json.client.JSONBoolean;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;

public class CytoscapeWebEdgeData extends JSONObject {
	protected CytoscapeWebEdgeData() {
		
	}
	
	public CytoscapeWebEdgeData(JavaScriptObject jso) {
		super(jso);
	}
	
	public CytoscapeWebEdgeData (String sourceId, String targetId, boolean directed) {
		super();
		setSource(sourceId);
		setTarget(targetId);
		setDirected(directed);
	}
	
	public CytoscapeWebEdgeData(CytoscapeWebNode source, CytoscapeWebNode target, boolean directed) {
		this(source.getData().getId(), target.getData().getId(), directed);
	}
	
	public String getId() { return this.get("id").isString().stringValue(); }
	public CytoscapeWebEdgeData setId(String id) {
		this.put("id", new JSONString(id));
		return this;
	}
	public String getSource() { return this.get("source").isString().stringValue(); }
	public CytoscapeWebEdgeData setSource(String id) {
		this.put("source", new JSONString(id));
		return this;
	}
	public String getTarget() { return this.get("target").isString().stringValue(); }
	public CytoscapeWebEdgeData setTarget(String id) {
		this.put("target", new JSONString(id));
		return this;
	}
	public boolean isDirected() { return this.get("directed").isBoolean().booleanValue(); }
	public CytoscapeWebEdgeData setDirected(boolean directed) {
		this.put("directed", JSONBoolean.getInstance(directed));
		return this;
	}
}
